package com.wsjc.manager.service.routine.datalog.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wsjc.common.core.page.PageBean;
import com.wsjc.common.core.page.PageParam;
import com.wsjc.manager.dao.datalog.WjDataLogDao;
import com.wsjc.manager.entity.WjDataLog;
import com.wsjc.manager.service.routine.datalog.WjDataLogService;

/**
 * 数据处理日志service实现类
 */
@Service("wjDataLogService")
public class WjDataLogServiceImpl implements WjDataLogService{

	@Autowired
	private WjDataLogDao wjDataLogDaoImpl;
	
	@Override
	public void saveData(WjDataLog wjDataLog) {
		wjDataLog.setVersion(0);
		wjDataLogDaoImpl.insert(wjDataLog);
	}

	@Override
	public void updateData(WjDataLog wjDataLog) {
		wjDataLogDaoImpl.update(wjDataLog);
	}

	@Override
	public WjDataLog getDataById(String id) {
		return wjDataLogDaoImpl.getById(id);
	}

	@Override
	public PageBean listPage(PageParam pageParam, WjDataLog wjDataLog) {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dataId", wjDataLog.getDataId());
		paramMap.put("push_status", wjDataLog.getPushStatus());
		paramMap.put("map_status", wjDataLog.getMapStatus());
		paramMap.put("statistics_status", wjDataLog.getStatisticsStatus());
		paramMap.put("data_status", wjDataLog.getDataStatus());
		return wjDataLogDaoImpl.listPage(pageParam, paramMap);
	}
	
	@Override
	public WjDataLog getDataByUserNo(String userNo){
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("userNo", userNo);
		return wjDataLogDaoImpl.getBy(paramMap);
	}

	@Override
	public List<WjDataLog> listBy(Map<String, Object> paramMap) {
		return wjDataLogDaoImpl.listBy(paramMap);
	}

}